Encoding-free javascript stringify for clientless vpn

ABSTRACT

A client device requests a web page via a clientless VPN. In response to the request, web page content comprising at least one script element is received at the clientless VPN. The clientless VPN inserts a wrapper function around at least a portion of the script element, forming modified web content. The client device is provided with the modified web content.

CROSS REFERENCE TO OTHER APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/046,881 entitled ENCODING-FREE JAVASCRIPT STRINGIFY FOR CLIENTLESSVPN filed Jul. 26, 2018, which is incorporated herein by reference forall purposes.

BACKGROUND OF THE INVENTION

A firewall generally protects networks from unauthorized access whilepermitting authorized communications to pass through the firewall. Afirewall is typically a device or a set of devices, or software executedon a device, such as a computer, that provides a firewall function fornetwork access. For example, firewalls can be integrated into operatingsystems of devices (e.g., computers, smart phones, or other types ofnetwork communication capable devices). Firewalls can also be integratedinto or executed as software on computer servers, gateways,network/routing devices network routers), or data appliances (e.g.,security appliances or other types of special purpose devices).

Firewalls typically deny or permit network transmission based on a setof rules. These sets of rules are often referred to as policies (e.g.,network policies or network security policies). For example, a firewallcan filter inbound traffic by applying a set of rules or policies toprevent unwanted outside traffic from reaching protected devices. Afirewall can also filter outbound traffic by applying a set of rules orpolicies. Firewalls can also be capable of performing basic routingfunctions.

BRIEF DESCRIPTION OF THE DRAWINGS

Various embodiments of the invention are disclosed in the followingdetailed description and the accompanying drawings.

FIG. 1 is an example clientless VPN computing environment thatillustrates a traditional clientless VPN approach.

FIG. 2 is a protocol diagram of a traditional URL rewrite.

FIG. 3A is a clientless VPN computing environment that illustrates asecure domain rewriting technique in accordance with variousembodiments.

FIG. 3B illustrates an example of a portal as rendered in a client webbrowser.

FIG. 4 is a protocol diagram for a secure domain rewrite in accordancewith some embodiments.

FIG. 5 illustrates a data appliance in accordance with some embodiments.

FIG. 6 is a functional diagram of an architecture of a data appliance inaccordance with some embodiments.

FIG. 7 is a flow diagram of a process for an advanced clientless VPN inaccordance with various embodiments.

FIG. 8 is another flow diagram of a process for an advanced clientlessVPN in accordance with various embodiments.

FIG. 9A illustrates an example of HTML that can be received by a dataappliance for processing.

FIG. 9B illustrates an example of a page after processing by anembodiment of a data appliance.

FIG. 9C illustrates an alternate example of a page after processing byan embodiment of a data appliance.

FIG. 9D illustrates an example of an excerpt of JavaScript code to whicha data appliance has applied a wrapper.

FIG. 10 illustrates an example of a process for handling, at aclientless VPN, the rewriting of dynamic content.

FIG. 11 illustrates an example of a process for handling web storageinteractions for a clientless VPN environment.

FIGS. 12A-12C depict examples of JavaScript code.

FIG. 13 illustrates an example of a snippet of JavaScript code.

FIG. 14 illustrates an example of a process for handling obfuscated codein a clientless VPN environment.

FIG. 15 illustrates pseudocode excerpts of examples of replacementfunctions.

FIG. 16 illustrates an example of a way to hook the “src” attribute ofan HTML image object.

FIG. 17A illustrates an example of a modified setter function.

FIG. 17B illustrates an example of a modified getter function.

DETAILED DESCRIPTION

The invention can be implemented in numerous ways, including as aprocess; an apparatus; a system; a composition of matter; a computerprogram product embodied on a computer readable storage medium; and/or aprocessor, such as a processor configured to execute instructions storedon and/or provided by a memory coupled to the processor. In thisspecification, these implementations, or any other form that theinvention may take, may be referred to as techniques. In general, theorder of the steps of disclosed processes may be altered within thescope of the invention. Unless stated otherwise, a component such as aprocessor or a memory described as being configured to perform a taskmay be implemented as a general component that is temporarily configuredto perform the task at a given time or a specific component that ismanufactured to perform the task. As used herein, the term ‘processor’refers to one or more devices, circuits, and/or processing coresconfigured to process data, such as computer program instructions.

A detailed description of one or more embodiments of the invention isprovided below along with accompanying figures that illustrate theprinciples of the invention. The invention is described in connectionwith such embodiments, but the invention is not limited to anyembodiment. The scope of the invention is limited only by the claims andthe invention encompasses numerous alternatives, modifications andequivalents. Numerous specific details are set forth in the followingdescription in order to provide a thorough understanding of theinvention. These details are provided for the purpose of example and theinvention may be practiced according to the claims without some or allof these specific details. For the purpose of clarity, technicalmaterial that is known in the technical fields related to the inventionhas not been described in detail so that the invention is notunnecessarily obscured.

Clientless Virtual Private Network (VPN) solutions exist, includingclientless VPN software/devices (e.g., security/firewalldevices/appliances that execute clientless VPN software on a processor).When a client (e.g., user device, such as a laptop, desktop computer,mobile device, or other type of computing device) uses a clientless VPNto visit an application such as a web site, existing/traditional VPNsoftware/devices typically rewrite the Uniform Resource Identifier (URI)(e.g., Uniform Resource Locator (URL)) as the same domain but with adifferent URI path (e.g., rewritinghttps://www.example1-website.com/index.html tohttps://vpn.myfirewall.com/https_example1-website.com/index.html andrewriting https://example2-website.com/index.html tohttps://vpn.myfirewall.com/https_example2-website.com/index.html).However, the existing/traditional clientless VPN approachcreates/exposes multiple security vulnerabilities (e.g., securityflaws/holes). For example, due to the URI rewrite that results in thesharing of the common/same domain (e.g., the shared domain in the aboveexample is vpn.myfirewall.com), an attacker (e.g., a hacker or otherunauthorized user) could potentially execute code (e.g., run anyJavaScript or other code) on any web site that is supported by theclientless VPN solution (e.g., example1-website.com andexample2-website.com in the above example). Specifically, as a result ofsharing a common/same domain, such an attack could bypass the securitycheck(s) currently implemented in commercially available web browsers,as further discussed below. Thus, what is needed is an improvedclientless VPN solution.

I. Overview of Techniques for an Advanced Clientless VPN

Various techniques for an advanced clientless VPN are disclosed. Thedisclosed techniques can facilitate efficient performance and enhancedsecurity for clientless VPN solutions as will be further describedbelow.

In some embodiments, a system, process, and/or computer program productfor an advanced clientless VPN includes receiving a request for accessto an application (e.g., an external web site) from a client device;translating the request for access to the application to generate a newdomain (e.g., a new domain that is distinct); and providing the clientdevice with access to the application using the new domain. For example,the clientless VPN can be executed/implemented on an appliance, gateway,server (e.g., including a virtual server), or other computing device(e.g., a clientless VPN gateway/firewall can be implemented on asecurity/firewall device or other networking device).

In one embodiment, the request includes a Uniform Resource Identifier(URI) associated with the application, and translating the request foraccess to the application to generate the new domain further includeshashing the Fully Qualified Domain Name (FQDN) of the application togenerate a translation result. For example, the FQDN for a requestedapplication can be hashed (e.g., using a Base64, MD5, or other hashfunction). The hash result can then be prepended to an existing FQDNpart of the URI for accessing the clientless VPN, such as furtherdescribed below. As also further described below, a local Domain NameSystem (DNS) server can be configured to map the new domain(s) generatedby the clientless VPN to an IP address(es) associated with the system(e.g., clientless VPN gateway/firewall device(s)) (e.g., using awildcard DNS mapping, such as *.vpn.myfirewall.com).

In various embodiments, the advanced clientless VPN provides additionalfunctionality. Examples of such functionality are as follows. Theadvanced clientless VPN can process and forward a cookie received fromthe application to a browser executed on the client device. The advancedclientless VPN can authenticate a user associated with the request foraccess to the application from the client device. The advancedclientless VPN can process a HyperText Transfer Protocol (HTTP) requestfrom a browser executed on the client device and send the HTTP requestto the application. The advanced clientless VPN can process an HTTPresponse from the application and send the HTTP response to a browserexecuted on the client device. The advanced clientless VPN can alsorewrite a header of a URI, and can rewrite content received from theapplication, wherein the application content includes a web site.

In various embodiments, a local DNS server is configured to wildcardeach of the supported web sites (e.g., *.vpn.myfirewall.com) tofacilitate the disclosed techniques for a secure clientless VPNframework. For example, each web site can be associated with a distinctdomain that is generated using the disclosed techniques (e.g.,AZU1.vpn.myfirewall.com and BSD2.vpn.myfirewall.com) but still have acommon root domain (e.g., vpn.myfirewall.com), as further describedbelow with respect to FIGS. 3A, 3B, and 4. The local DNS server on theenterprise network can be configured to associate an IP address(es) ofthe VPN/firewall device(s) for each of the supported web sites (e.g.,multiple VPN/firewall devices can be deployed to facilitate efficientworkload balancing), as also further described below with respect toFIGS. 3A, 3B, and 4.

For example, the disclosed techniques provide for a more secure solutionfor clientless VPNs. Specifically, the disclosed techniques overcome thesecurity problems of existing clientless VPN solutions. Morespecifically, the disclosed techniques do not expose a securityvulnerability (e.g., do not perform a rewrite that shares a common/samedomain as described above with respect to existing/traditionalclientless VPN approaches). As a result, an attack cannot bypass thesecurity check(s) (e.g., same origin policy) currently implemented incommercially available web browsers, as further discussed below.

As another example, the disclosed techniques provide for a moreefficient solution for clientless VPNs. Specifically, the disclosedtechniques can utilize less storage for storing (e.g., caching) cookiesat the clientless VPN server/device, which is a requirement of existingclientless VPN solutions. As further described below, the disclosedtechniques can forward the cookies to the client devices (e.g., webbrowsers executed on the client devices for storing locally at theclient devices) without having to store (e.g., locally cache) cookies atthe clientless VPN server/device (e.g., improving data plane performanceof a security device/appliance, because such server-side cookies do nothave to be stored at the security device/appliance as such can beforwarded to the client devices), which reduces storage hardwarerequirements for clientless VPN devices and also reduces computationaltime for performing a look-up and fetching of such cookies as performedby existing clientless VPN solutions.

These and other aspects of the disclosed techniques for an advancedclientless VPN will be further described below.

II. Existing Approaches to Clientless VPN

FIG. 1 is an example clientless VPN computing environment thatillustrates a traditional clientless VPN approach. Referring to FIG. 1,a clientless VPN 102 (e.g., implemented/executed on a security/firewalldevice/appliance) provides a traditional clientless VPN approach thatsupports an example web site 106 and example web site 108 to facilitateVPN access to those web sites for a client device 104 (e.g., clientdevice 104 includes a commercially available web browser, but is notconfigured with a locally executed VPN client).

As also shown in FIG. 1, clientless VPN 102 includes components forimplementing a clientless VPN solution. An Authenticator 112 is anauthentication component. For example, a user can log into theclientless VPN solution via a web browser executed on client device 104(e.g., access a login page by navigating the web browser to a URL forthe firewall that provides the clientless VPN solution, such ashttps://vpn.myfirewall.com). The authenticator component can verify auser's entered credentials (e.g., login and password, biometric, and/orother credentials, including two/multi-factor authentication). Theauthenticated user can then submit a request to access a supportedapplication/web site (e.g., a user can click an app/link that allows theuser to access external apps/web sites, such as workday.com shown at106, box.com shown at 108, or another supported web site (not shown inFIG. 1), such as facebook.com, mail.google.com, or another website/service). An HTTP Request/Response Processor 114 processes therequest utilizing one or more of the rewrite engine component(s) shownas an HTTP Header Rewriter 116 and an HTTP Content Rewriter 118, and acookie processing component shown as Cookie Processor/Cache 120, asfurther described below.

In this example, HTTP Header Rewriter 116 rewrites the Uniform ResourceIdentifier (URI) (e.g., Uniform Resource Locator (URL)) as the samedomain but with a different URI path. For example, the HTTP headerrewriter can rewrite a requested URI from clienthaps://vpn.myfirewall.com/https www.workday.com tohttps://www.workday.com (e.g., or similarly rewrite another requestedURI for other supported web sites, such ashttps://vpn.myfirewall.com/https_www.box.com,https://vpn.myfirewall.com/https_www.facebook.com, andhttps://vpn.myfirewall.com/https_mail.google.com).

In this example, HTTP Content Rewriter 118 rewrites content of thereturned web page(s), such as a returned web page for the supported website (e.g., web sites 106, 108, or similarly for other supported websites). For example, the content of the returned web page can similarlyprocess URIs included in the web page (e.g., embedded in HTML of the webpage), such as shown in the below example.

Example web page content for a supported web site (e.g., workday.com) isprovided below (e.g., this is the version of the web page received fromthe workday.com web site that is to be processed by the clientless VPNprior to sending to the browser executed on the client device).

  <html> <script src=“/js/help.js”></script> <imgsrc=”http://www.example-web-site.com/logo.jpg”< <a href=“/login/login.php”> click to login </a> . . . </html>

Example web page content for the supported web site (e.g., workday.com)after processing by the HTTP content rewriter component is providedbelow (e.g., the processed web page can be sent from the clientless VPNto the browser executed on the client device).

<html> <script src=“/https_www.workday.com/js/help.js”></script> <imgsrc=“https://vpn.myfirewall.com/http_www.example-web-site.com/logo.jpg”> <a href=“/https_www.workday.com/login/login.php”> click tologin </a> . . . </html>

However, as discussed above, this traditional clientless VPN approachexposes a security loophole in view of existing web browser securitychecks. Specifically, the above-described URI rewriting results in thesharing of a common/same domain the shared domain in the above exampleis vpn.myfirewall.com). As a result, an attacker (e.g., a hacker orother unauthorized user) can execute code (e.g., run any JavaScript orother code) on any web site that is supported by the clientless VPNsolution. More specifically, as a result of using the shared samedomain, such an attack will bypass the security check(s) currentlyimplemented in commercially available web browsers, as further discussedbelow.

Security protections implemented in current web browsers (e.g., MozillaFirefox, Microsoft Internet Explorer®, and Google Chrome) includesame-origin (e.g., domain) and cross-origin checks, as well as cookieand Ajax checks. Specifically, implementing a same-origin policy, a webbrowser typically only permits scripts to access data in a second webpage if the web pages have the same origin (e.g., URI scheme, hostname,and port number). For example, commercially available web browsersgenerally implement the same-origin policy checks to prevent, forexample, a malicious script on one web page from obtaining access todata on another web page or to perform other malicious or unwantedactivities.

Cross-origin checks provide a more flexible mechanism that specifies howa browser and server can interact to determine whether or not to allowthe cross-origin requests. For example, cross-origin resource sharing(CORS) can allow/trust certain cross-origin requests, such as forrestricted resources, such as fonts, on a web page to be requested fromanother domain, but is more secure than allowing/trusting allcross-origin requests.

Another security protection implemented in current web browsers is toprevent other web pages from framing the web site to defend againstclickjacking. For example, a browser can implement frame-breakingmechanisms to determine whether the browser should be allowed to rendera page in a frame (e.g., <frame> or <iframe>) to avoid clickjackingattacks (e.g., to ensure that the web site's content is not embeddedinto other sites).

However, the above-described traditional URL rewrite approach results inthe browser's requests being a shared/common domain (e.g., in theabove-described example, https://vpn.myfirewall.com). As such, theabove-described traditional URL rewrite approach renders it possible fora malware injected in one of the web sites supported by the clientlessVPN, such as shown for authorized web site 108 (e.g., in theabove-described example, www.box.com) to execute code (e.g., a script,such as Java Script or other code/script) on another web site 106 (e.g.,a different domain, such as www.workday.com as shown in FIG. 1), becausethe same-origin policy is not applied by the browser due to both thesupported/authorized access to web site 106 and the other web site 108are each accessed using the same firewall host (e.g., same domain, whichis https://vpn.myfirewall.com in this example). As shown in FIG. 1, anauthorized access to web site 106 would also allow access to another website 108 or vice versa as a result of the appearance of such requestshaving the same origin to the web browser (e.g., same domain, which ishttps://vpn.myfirewall.com in this example).

FIG. 2 is a protocol diagram of a traditional URI, rewrite. Atraditional clientless VPN approach as similarly described above withrespect to FIG. 1 is further described with respect to the protocoldiagram as shown in FIG. 2.

Referring to FIG. 2, a client/browser 204 (e.g., a user computing deviceexecuting a web browser) is in communication (e.g., network/HTTP(S)communication) with a firewall/gateway 202 (e.g., a securitydevice/appliance that executes a firewall and a clientless VPNsolution). Firewall/gateway 202 is in communication (e.g.,network/HTTP(S) communication) with an application 206 (e.g., a web siteor other application)

As shown at a first stage (1), a user logs into the firewall (202)(e.g., https://vpn.myfirewall.com) as similarly described above withrespect to FIG. 1.

At a second stage (2), after a successful authentication, the user isredirected to an application (e.g., https://www.myapp.com/start.html),and the firewall (202) returns the location for the application (e.g.,https://vpn.myfirewall.com/https_www.myapp.com/start.html), and alsosets VPN_SESSION_COOKIE which tracks the user session onvpn.myfirewall.com.

At a third stage (3), the browser (204) sends an HTTP request (e.g.,GET/https_www.myapp.com/start.html Host: www.myfirewall.com). Thefirewall (202) rewrites the URL/HOST (e.g., using a rewrite engine, suchas including an HTTP Header Rewriter 116 as similarly described abovewith respect to FIG. 1) and sends the request to the application (206)(e.g., GET/start.html Host: www.myapp.com). The application response isthen provided that includes a cookie (e.g., Set-Cookie: app_ck=XYZ;domain=myapp.com; path=/) and HTML content of a web page (e.g., thesupported application (206) in this example is for a salesforce.com website, which is https://vyww.salesforce.com). As also shown in thisexample response from the application (206), the HTML content includes alink to another supported application, which is for a box.com web site(e.g., https://www.box.com). As similarly described above, the firewall(202) rewrites the HTML content (e.g., using a rewrite engine, such asincluding an HTTP Content Rewriter 118 as similarly described above withrespect to FIG. 1) to rewrite the embedded URLs to append the embeddedURLs (e.g., associated with supported web sites) afterhttps//vpn.myfirewall.com. As also similarly described above, thefirewall (202) processes the cookie (e.g., using Cookie Processor/Cache120 as similarly described above with respect to FIG. 1) andstares/caches the cookie (e.g., the cookie is stored at the firewall(202)).

At a fourth stage (4), the application response (e.g., as rewritten asdescribed above) is sent to the browser (204) with NO Set-Cookie withcontent rewritten on the firewall.

At a fifth stage (5), the user clicks on the intranet link and thebrowser (204) sends the request with no application cookies but with VPNportal cookie VPN_SESSION_COOKIE (e.g., sending a request as shown thatincludes GET/https_www.myapp.com/sites/intranet HOST: vpn.myfirewall.comCookie: VPN_SESSION_COOKIE: session_id). As shown, the firewall (202)rewrites the URL and also adds a cookie header to send to theapplication (206) (e.g., GET/sites/intranet HOST: www.myapp.com Cookie:app_ck=XYZ).

However, the above-described traditional URL rewrite approach results inthe browser's requests being a shared/common domain (e.g., in theabove-described example, vpn.myfirewall.com), which exposes a securityvulnerability in web browsers as discussed above.

Accordingly, new and improved techniques for an advanced clientless VPNare disclosed as will now be further described with respect to FIGS. 3A,3B, and 4.

III. Techniques for an Advanced Client less VPN

FIG. 3A is a clientless VPN computing environment that illustrates asecure domain rewriting technique in accordance with variousembodiments. Referring to FIG. 3A, a clientless VPN of a data appliance302 (e.g., implemented/executed on a security/firewalldevice/appliance/gateway) provides an advanced clientless VPN solutionthat supports an example web site 306 and example web site 308 tofacilitate VPN access to those web sites for a client device 304 (e.g.,client device 304 includes a commercially available web browser, but isnot configured with a locally executed VPN client).

In one embodiment, secure clientless VPN 302 includes components forimplementing an advanced clientless VPN solution as shown in FIG. 3A. Asone example, authenticator 312 is a component that authenticates users.For example, a user can log into the advanced clientless VPN solutionvia a web browser executed on client device 304 (e.g., access a loginpage by navigating the web browser to a URI for the firewall thatprovides the clientless VPN solution, such ashttps://vpn.myfirewall.com). The authenticator component verifies auser's entered credentials (e.g., login and password, biometric, and/orother credentials, including two/multi-factor authentication). Oneauthenticated, the user is presented, in various embodiments, with aportal, an example of which is illustrated in FIG. 3B. JavaScript isserved (e.g., as “panportal.js”) to the user in conjunction withrendering portal 350 in the user's browser (e.g., portal 350incorporates JavaScript). As will be described in more detail below, theJavaScript is used to help support clientless VPN functionality,including by augmenting/superseding various native functionality of theend user's browser, and also to perform other actions, such as rewritingURIs (e.g., URIs not otherwise rewritten by appliance 302). In variousembodiments, the JavaScript provided by portal 350 incorporates an opensource or other JavaScript interpreter/parser (an example of which isEsprima, available at esprima.org), which can perform lexical analysis(tokenization) or syntactic analysis (parsing) of passed JavaScript. Theinterpreter/parser can be used to analyze JavaScript passed to it bydata appliance 302 to extract URIs and rewrite them, as applicable.

The authenticated user can interact with portal 350 to submit requeststo access supported applications/web sites. As one example, a user canclick an app/link that allows the user to access external apps/websites. Examples of such apps/links accessible via portal 350 includeworkday.com (352), box.com (354), and as applicable, other apps/links(e.g., to resources stored on a corporate intranet (356)). If the userwishes to visit sites for which apps/links are not provided in region358 (e.g., wwv.facebook.com or www.gmail.com), the user can click onregion 360 and type in a destination (e.g., www.wikipedia.org) in theresulting dropdown.

An HTTP Request/Response Processor 314 processes the request utilizingone or more of the rewrite engine component(s) shown as an HTTP HeaderRewriter 316 and an HTTP Content Rewriter 318, and a cookie processingcomponent shown as Cookie Processor/Cache 320, as further describedbelow.

In one embodiment, HTTP Header Rewriter 316 rewrites the URI from theclient to the original application. For example, the HTTP headerrewriter can rewrite a requested URI https://www.workday.com/ tohttps://www.workday.com.https.vpn.myfirewall.com/ (e.g., or similarlyrewrite another requested URI for other supported web sites, such ashttps://www.box.com/ to https://www.box.com.https.vpn.myfirewall.com/).

In one embodiment, HTTP Content. Rewriter 318 rewrites content of thereturned web page(s), such as a returned web page for the supported website (e.g., web sites 306, 308, or similarly for other supported websites). For example, the content of the returned web page can similarlyprocess URIs included in the web page (e.g., embedded in HTML of the webpage), such as shown in the below example.

Example web page content for a supported web site (e.g., workday.com) isprovided below (e.g., this is the version of the web page received fromthe workday.com web site that is to be processed by the advancedclientless VPN prior to sending to the browser executed on the clientdevice).

<html>   <script src=“/js/help.js”></script> <imgsrc=”https://www.example-web-site.com/logo.jpg”> <a href=“/login/login.php”> click to login </a> . . . </html>

Example web page content for the supported web site (e.g., workday.com)after processing by the HTTP content rewriter component is providedbelow (e.g., the processed web page can be sent from the advancedclientless VPN to the browser executed on the client device).

<html> <script src: “/js/help.js/https_www.firewall.com” <imgsrc=”https://www.example-web-site.com.https.vpn.myfirewall.com/logo.jpg″> <a href= “/login/login.php”> click to login </a> . . .</html>

Thus, the disclosed advanced clientless VPN rewrites URIs such that thedomains (e.g., including for each of the supported web sites) aredistinct unlike the traditional clientless VPN approach that rewritesURIs such that they share a common same domain (e.g., the shared domainin the above example is vpn.myfirewall.com), which exposes a securityloophole in view of existing web browser security checks (e.g.,same-origin checks) as described above. As a result, unlike thetraditional rewrite approach performed by existing clientless VPNs, anattacker (e.g., a hacker or other unauthorized user) cannot execute code(e.g., run any JavaScript or other code) on any web site that issupported by the advanced clientless VPN solution using the disclosedsecure URI rewrite techniques. Specifically, as a result of rewritingURIs of supported applications (e.g., web sites) such that the domainsare distinct, such an attack cannot bypass the security check(s)currently implemented in commercially available web browsers, such assame-origin (e.g., domain) and cross-origin checks, as well as cookieand Ajax checks as described above.

Referring to FIG. 3A, the above-described secure URI rewrite approachdoes not allow for a malware injected in one of the web sites supportedby the clientless VPN as shown for authorized web site 308 (e.g., in theabove-described example, www.box.com) to execute code (e.g., a script,such as JavaScript or other code/script) on another web site 306 (e.g.,a different domain, such as www.workday.com as shown in FIG. 3A),because the same-origin policy is applied by the browser due to thesupported/authorized access to web site 306 having the workday,comdomain that is different than the other web site 308 having the box.comdomain in this example even after the URI rewrite is performed by theadvanced clientless VPN. As shown in FIG. 3A, an authorized access toweb site 306 would not allow access to another web site 308 or viceversa as a result of the requests having distinct domains. For example,the web browser can properly apply a domain script, whether to allow ascript from a different domain to execute or not based on a domainsecurity/validation check (e.g., grant or block for JavaScript toexecute based on domain match or not).

In one embodiment, Cookie Processor/Cache 320 can forward cookiesreceived from the supported web sites to the client device as furtherdescribed below with respect to FIG. 4. For example, unlike theabove-described traditional clientless VPN approach, because thedisclosed techniques for a secure clientless VPN rewrite the URIs toutilize distinct domains, the cookies do not have to be stored at thefirewall device and associated in a cookie/session table with eachrespective session. As a result, this technique improves computationalefficiency to reduce compute time as such lookups in a cookie/sessiontable need not be performed by the firewall/gateway (302) and storagerequirements as such cookies need not be stored for active sessions atthe firewall/gateway (302) (e.g., which can be costly from a storagerequirement perspective on a firewall device, such as if there arethousands or more active sessions with cookies given the potential sizesof the cookies).

A. Translating the Requested Domains and DNS Wildcard Techniques

In one embodiment, the disclosed techniques for an advanced clientlessVPN include hashing the requested FQDN part of URI for a supportedapplication (e.g., web site 306 or 308) to generate a hash result (e.g.,a unique value). For example, the requested URI can beconverted/translated using a hash function (e.g., translated usingBase64, MD5, or another hash function), and the converted/translatedvalue can then be prepended to the URI for the firewall/gateway (302) aswill now be described. In this example, assuming that www.workday.com isconverted/translated (e.g., hashed) to a value of BSD2, then therequested URI can be rewritten as BSD2.vpn.myfirewall.com. Similarly,assuming that www.dropbox.com is converted/translated (e.g., hashed) toa value of BSD2, then the requested URI can be rewritten asBSD2.vpn.myfirewall.com. The hash can be used to uniquely identify theURI for the supported application. Also, the hash can effectivelyshorten rewritten FQDN names (e.g., which can avoid generating rewrittenFQDN part of URIs that are too long as commercially available webbrowsers can specify maximum lengths of FQDNs and exceeding that maximumlength can result in an error).

In one embodiment, a DNS server (e.g., a local DNS server(s)) for anenterprise network for the client device (304) is configured withwildcard versions for the advanced clientless VPN device (e.g.,*.vpn.myfirewall.com in this example). For example, the local DNS servercan be configured to map *.vpn.myfirewall.com to IP addresses for a setof firewall devices (e.g., 192.168.10.5. 192.168.10.6, and 192.168,10.7for the three firewall devices) to provide for workload balancing acrossthe set of firewall devices for the enterprise network.

Accordingly, the disclosed techniques facilitate workload balancingacross the set of firewall devices for a more efficient and secureclientless VPN solution for the enterprise network computingenvironment. Moreover, the disclosed techniques are more secure thanexisting clientless VPN techniques, as similarly discussed above (e.g.,malware injected in a supported web site, such as 308, that attempts toexecute code from another web site, such as 306 or vice versa, would beprevented from executing that code with the disclosed secure domainrewriting, because the same origin policy in the browser would not allowfor such across distinct domains).

FIG. 4 is a protocol diagram for a secure domain rewrite in accordancewith some embodiments. The disclosed techniques for an advancedclientless VPN as similarly described above with respect to FIG. 3A arefurther described with respect to the protocol diagram as shown in FIG.4.

Referring to FIG. 4, a client/browser 404 (e.g., a user computing deviceexecuting a web browser) is in communication (e.g., network/HTTP(S)communication) with a firewall/gateway 402 (e.g., a securitydevice/appliance that executes a firewall and an advanced clientless VPNsolution or a firewall that includes an advanced clientless VPN).Firewall/gateway 402 is in communication (e.g., network/HTTP(S)communication) with an application 406 (e.g., a web site or otherapplication).

As shown at a first stage (1), a user logs into the firewall (402)(e.g., https://vpn.myfirewall.com) as similarly described above withrespect to FIG. 3A.

At a second stage (2), after a successful authentication, the user isredirected to an application (e.g., https://www.myapp.com/start.html),and the firewall (402) returns the location for the application(e.g.,https:// www.myapp.com.https.vpn.myfirewall.com/start.html), and alsosets VPN_SESSION COOKIE to .vpn.myfirewall.com domain which tracks theuser session on vpn.myfirewall.com.

At a third stage (3), the browser (404) sends an HTTP request (e.g.,GET/start.html Host: www.myapp.com.https.vpn.myfirewall.com). Thefirewall (402) rewrites the URL/HOST (e.g., using a rewrite engine, suchas including an HTTP Header Rewriter 316 as similarly described abovewith respect to FIG. 3A) and sends the request to the application (406)(e.g., GET/start.html Host: www.myapp.com). The application response isthen provided that includes a cookie (e.g., Set-Cookie: app_ck=XYZ;domain=myapp.com; path=/) and HTML content of a web page (e.g., theapplication (406) in this example is for a salesforce.com web site,https://www.salesforce.com). As also shown in this example response fromthe application (406), the HTML content includes a link to anothersupported application, which is for a box.com web site (e.g.,https://www.box.com). As similarly described above, the firewall (402)rewrites the HTML content (e.g., using a rewrite engine, such asincluding an HTTP Content Rewriter 318 as similarly described above withrespect to FIG. 3A) to rewrite the embedded URLs to prepend the embeddedURLs as similarly described above with respect to FIG. 3A (e.g., in somecases, if the web page included a link to www.cnn.com and if www.cnn.comis not a supported web site for the clientless VPN, then that link forcnn.com would be rewritten by the HTTP Content Rewriter; however, thesecurity policies configured on the firewall would prevent theclient/user from further accessing www.cnn.com). As also similarlydescribed above, the firewall (402) processes the cookie (e.g., usingCookie Processor/Cache 320 as similarly described above with respect toFIG. 3A, and the cookie can be processed as also further describedbelow) to forward the cookie to the browser (404) (e.g., and theclient/browser (404) can then locally store the cookie on the clientdevice).

At a fourth stage (4), the application response (e.g., as rewritten bythe firewall (402) as described above) is sent to the browser (404) witha Set-Cookie and with content rewritten on the firewall (e.g., rewrittenusing the advanced clientless VPN components as described above). Asshown, the domain of the Set-Cookie was rewritten on the firewall (402)(e.g., Set-Cookie: app_ck=XYZ;domain=myapp.com.https.vpn.myfirewall.com; path=/). As also shown, theembedded URLs (e.g., associated with supported web sites) of the HTMLcontent were rewritten on the firewall (402) (e.g., rewriting theembedded URLs of https://www.salesforce.com/index.html tohttps://www.salesforce.com.https.vpn.myfirewall.com/index.html andhttps://www.box.com/default.html tohttps://www.box.com.https.vpn.myfirewall.com/default.html).

At a fifth stage (5), the user clicks on the intranet link and thebrowser (404) sends the request with the cookie(s) (e.g., sending arequest as shown that includes GET/sites/intranet HOST:www.myapp.com.https.vpn.myfirewall.com and Cookie: app-ck=XYZ). Asshown, the firewall (402) rewrites the URL/Host to send to theapplication (406) (e.g., GET/sites/intranet HOST: www.myapp.com Cookie:app_ck=XYZ).

Accordingly, new and improved techniques for an advanced clientless VPNare disclosed and can be implemented using a data appliance thatincludes a firewall as will now be further described with respect toFIGS. 5 and 6.

B. Example Components of a Data Appliance

FIG. 5 illustrates a data appliance in accordance with some embodiments.The example shown is a representation of physical components that areincluded in data appliance 302 (e.g., a firewall/securitydevice/gateway/appliance or other computing device that can execute afirewall and a clientless VPN or a firewall that includes animplementation of an advanced clientless VPN as described herein), invarious embodiments. Specifically, data appliance 302 (e.g., a devicethat performs various security related functions, such as a securitydevice, which can be in the form of, for example, a security appliance,security gateway, security server, and/or another form of a securitydevice) includes a high performance multi-core CPU 502 and RAM 504. Dataappliance 302 also includes a storage 510 (such as one or more harddisks), which is used to store policy and other configurationinformation, as well as other information, such as URL categorizationinformation and/or malware signatures. Data appliance 302 can alsoinclude one or more optional hardware accelerators. For example, dataappliance 302 can include a cryptographic component 506 configured toperform encryption and decryption operations, and one or more FPGAs 508configured to perform matching (e.g., pattern matching, such as forapplication identification (App ID) as further described below withrespect to FIG. 6), act as network processors, and/or perform othertasks.

Data appliance 302 can take a variety of forms. For example, dataappliance 302 can be implemented as a single device, or as multipledevices working in cooperation. Whenever data appliance 302 is describedas performing a task, a single component, a subset of components, or allcomponents of data appliance 302 may cooperate to perform the task.Similarly, whenever a component of data appliance 302 is described asperforming a task, a subcomponent may perform the task and/or thecomponent may perform the task in conjunction with other components. Invarious embodiments, portions of data appliance 302 are provided by oneor more third parties. Depending on factors such as the amount ofcomputing resources available to data appliance 302, various logicalcomponents and/or features of data appliance 302 may be omitted and thetechniques described herein adapted accordingly. Similarly, additionallogical components/features can be included in embodiments of dataappliance 302 as applicable.

FIG. 6 is a functional diagram of an architecture of a data appliance inaccordance with some embodiments. As shown in FIG. 6, network traffic ismonitored at data appliance 302 (e.g., a firewall/securitydevice/gateway/appliance or other computing device that can execute afirewall and an advanced clientless VPN or a firewall that includes anadvanced clientless VPN). In one embodiment, network traffic ismonitored using a data appliance (e.g., a data appliance that includessecurity functions, such as a security device/appliance that includes afirewall or a virtual firewall). In one embodiment, network traffic ismonitored using a gateway (e.g., a gateway that includes securityfunctions, such as a security gateway/network gateway firewall). In oneembodiment, the network traffic is monitored using pass through (e.g.,in-line) monitoring techniques. In various embodiments, network trafficis monitored using a state-based firewall. The state-based firewall canmonitor traffic flows using an application (app) identifier (ID)component (e.g., APP-ID (App ID) engine, shown as App ID Check & User IDCheck 608 in FIG. 6). For example, the monitored network traffic caninclude HTTP traffic, HTTPS traffic, FTP traffic, SSL traffic, SSHtraffic, DNS requests, unclassified application traffic (e.g., unknownapplication traffic), and/or other types of traffic (e.g., traffic usingother types of known or unknown protocols).

As shown in FIG. 6, network traffic monitoring begins at 602. An IPaddress and port component 604 determines an IP address and port numberfor a monitored traffic flow (e.g., a session) based on packet analysis.A policy cheCk component 606 determines whether any policies can beapplied based on the IP address and port number. As also shown in FIG.6, an App ID Check & User ID Check 608 identifies an application and auser. For example, the application can be identified using an App IDcomponent (608) using various application signatures for identifyingapplications based on packet flow analysis (e.g., implemented using anFPGA, such as FPGA 508 as shown in FIG. 5). The user identification canalso be determined based on a source IP address e.g., based on one ormore IP addresses). In this example, the App ID component (608) can beconfigured to determine what type of traffic the session involves, suchas HTTP traffic, HTTPS traffic, FTP traffic, SSL traffic, SSH traffic,DNS requests, unknown traffic, and various other types of traffic, andsuch classified traffic can be directed to an appropriate decoder, suchas shown at 612, 614, and 616, to process the classified traffic foreach monitored session's traffic flow.

As also shown in FIG. 6, if the monitored traffic is encrypted (e.g.,encrypted using HTTPS, SSL, SSH, or another known encryption protocol),then the monitored traffic can be decrypted using a decrypt component610 (e.g., applying trusted man-in-the-middle techniques using aself-signed certificate associated with the network device, such as adata appliance, gateway, or other network device implementing thefirewall). A known protocol decoder component 612 decodes and analyzestraffic flows using known protocols (e.g., applying various signatures(622) for the known protocol) and reports the monitored traffic analysisto a report and enforce policy component 620. Identified traffic (nodecoding required) component 614 reports the identified traffic to thereport and enforce policy component 620. An unknown protocol decodercomponent 616 decodes and analyzes traffic flows (e.g., applying variousheuristics) and reports the monitored traffic analysis to the report andenforce policy component 620.

In various embodiments, the results of the various traffic monitoringtechniques using known protocol decoder component 612, identifiedtraffic component 614, and unknown protocol decoder component 616described above are provided to report and enforce policies component620 (e.g., network/routing policies, security policies, and/or firewallpolicies). For example, firewall policies can be applied to themonitored network traffic using application identification, useridentification, and/or other information to match signatures 622 (e.g.,application/APP ID signatures, such as URL signatures, file-based,protocol-based, and/or other types/forms of signatures for detectingmalware or suspicious behavior).

As also shown, appliance 302 also includes a content-ID component 618.In one embodiment, the content-ID component's identified content is alsoused by report and enforce policy component 620, possibly in variouscombinations with other information, such as application, user, and/orother information, to enforce various security/firewall policies/rules.

Additional example processes for he disclosed techniques for anadvanced. clientless VPN will now be described.

C. Example Processes for an Advanced Clientless VPN

FIG. 7 is a flow diagram of a process for an advanced clientless VPN inaccordance with various embodiments. In some embodiments, a process 700as shown in FIG. 7 is performed by the platform and techniques assimilarly described above including the embodiments described above withrespect to FIGS. 3A, 3B, and 4 (e.g., is performed by an advancedclientless VPN as described above with respect to FIGS. 3A, 3B, and 4).

The process begins at 702 when a request for access to an applicationfrom a client device is received at a clientless VPN. For example, auser can use the clientless VPN to initiate access to the application(e.g., an external web site) as similarly described above with respectto FIGS. 3A, 3B, and 4. The clientless VPN can be executed/implementedon an appliance, gateway, server (e.g., including a virtual server), orother computing device (e.g., a clientless VPN gateway/firewall that canbe implemented on a security/firewall device or other networking device)as also described above.

At 704, the request for access to the application is translated togenerate a new domain. For example, the clientless VPN can translate aURI associated with the request to generate a new domain. As similarlydescribed above, the clientless VPN can translate the URI request forthe access to the application to generate a new domain by hashing theURI to generate a translation result (e.g., using a Base64, MD5, orother hash function to generate a hash result), in which at least aportion of the new domain includes the translation result. In an exampleimplementation, the hash result can then be prepended to an existing URIfor accessing the clientless VPN, such as similarly described above withrespect to FIGS. 3A, 3B, and 4. As also described above, a local DNS canbe configured to map the new domain(s) generated by the clientless VPNto an IP address(es) associated with the system (e.g., using a wildcardDNS mapping, such as *.vpn.myfirewall.com, that can be mapped to an IPaddress(es) associated with clientless VPN gateway/firewall device(s)).

At 706, the client device is provided with access to the applicationusing the new domain. For example, the clientless VPN can provide theclient device with access to the application (e.g., external web site)using the new domain as similarly described above with respect to FIGS.3A, 3B, and 4.

FIG. 8 is another flow diagram of a process for an advanced clientlessVPN in accordance with various embodiments. In some embodiments, aprocess 800 as shown in FIG. 8 is performed by the platform andtechniques as similarly described above including the embodimentsdescribed above with respect to FIGS. 3A, 3B, and 4 (e.g., is performedby an advanced clientless VPN as described above with respect to FIGS.3A, 3B, and 4).

The process begins at 802 when a request for access to an applicationfrom a client device is received at a clientless VPN. For example, auser can log in to a firewall (e.g., that includes the clientless VPN)to initiate access to the application (e.g., an external web site) assimilarly described above with respect to FIGS. 3A, 3B, and 4.

At 804, processing an HTTP request from a browser executed on the clientdevice and sending the HTTP request to the application is performed. Forexample, the HTTP request can be processed as similarly described abovewith respect to FIGS. 3A, 3B, and 4.

At 806, processing an HTTP response from the application and sending theHTTP response to a browser executed on the client device is performed.For example, the HTTP response can be processed as similarly describedabove with respect to FIGS. 3A, 3B, and 4.

At 808, processing and forwarding a cookie received from the applicationto a browser executed on the client device is performed. For example,the cookie can be processed as similarly described above with respect toFIGS. 3A, 3B, and 4.

D. Handling JavaScript

In order to provide a good user experience (e.g., in an environmentincorporating data appliance 302), not only should a user be able tovisit a remote site (e.g., cnn.com), but also links made available onthat site (e.g., to various articles, other websites, etc.).Accordingly, in various embodiments (and, e.g., incorporating techniquesdescribed above), data appliance 302 rewrites URIs of links appearingwithin pages requested by clients (e.g., client device 304).

FIG. 9A illustrates an example of HTML that can be received by dataappliance 302 for processing (e.g., at the request of client device304). In the example shown, an end user is requesting a page associatedwith a gambling website. Included in the HTML are various links,including to a style sheet (902), and various JavaScript (904-906). Alsoincluded in page 900 is JavaScript code 908.

FIG. 9B illustrates an example of page 900 after processing by anembodiment of data appliance 302. Suppose the IP address of the dataappliance is 192.1.2.3 and that the URL of the gambling website iswww.onlinepokerplay.com. Link 902 is rewritten as link 952 (e.g., inaccordance with techniques described above, via regular expressions, orany other appropriate technique). Links 904 and 906 are similarlyrewritten by data appliance 302 as links 954 and 956, respectively.

In some embodiments, script 908 is similarly transformed by dataappliance 302. However, doing so may require more time/computingresources than would otherwise be available to data appliance 302(anchor could otherwise cause data appliance 302's performance todiminish below an acceptable level). For example (and as described inmore detail below), escaping single/double quotes and line breaks inJavaScript code of pages that pass through data appliance 302 canrequire significant computing resources on the part of data appliance302 (e.g., as data appliance 302 needs to interpret the packets lookingfor such bytes and convert them). Accordingly, in other embodiments,JavaScript appearing within a page (i.e., not linked to as with links904 and 906) is instead marked for processing by the end user's client(e.g., processing by panportal.js, which incorporates Esprima). Anexample of such marking by data appliance 302 is depicted in region 958.In particular, the JavaScript code is enclosed within a function(pan_eval) which is defined in panportal.js, and will be executed bypanportal.js on the end user's client. The pan_eval( ) function wrapsthe native JavaScript eval( ) function, and is a function that evaluatesJavaScript code represented as a string, in particular, to rewrite anyURIs made use of by the JavaScript.

In order to pass pan_eval( ) a string, in addition to inserting thepan_eval function itself, data appliance 302 also adds quotes (960, 962)and escapes newlines (964-974) and special characters such as singlequotes (e.g., 976) and double quotes (e.g., 978) in the JavaScript codeso that the code can be passed to pan eval as a single string argument.The pan eval function can then parse the string and convert/rewrite anyLab included in the string.

Example page 900 is a relatively simple web page, written entirely inASCII. However, web content can be authored in many different languages,and make use of a variety of types of Unicode encoding. Further, a givenweb page may include content authored in multiple languages, havingdifferent encodings. For example, Unicode can be implemented using avariety of character encodings, such as UTF-8, UTF-16, and UTF-32. InUTF-8, one byte is used for the first 128 code points, and up to anadditional four bytes are available for use by other characters. UTF-8is backwards compatible with ASCII, as the first 128 characters of UTF-8correspond, respectively with ASCII characters, using a single octetwith the same respective binary value. Accordingly, valid ASCII text isvalid UTF-8 encoded Unicode as well.

Suppose a web page includes content authored in Unicode with UTF-16encoding and that included in the page is JavaScript code that launchesa popup box that includes a message that uses Chinese characters. Anexample of a Chinese word is “

” which can be represented in binary as “01000010 01011100 0100001001011100” in UTF-16 encoding (and, for brevity, will be hereinafter bedenoted using hexadecimal: as “\x42\x5c\x42\x5c”). Unfortunately, aproblem can arise in embodiments of data appliance 302 when characterssuch as

are received. First, in various embodiments, data appliance 302 may notknow whether a given byte corresponds to which code page/language(without undertaking potentially resource intensive processing). If dataappliance 302 escapes characters by searching for known special symbols(e.g., “\” represented in binary as “1011100” and in hexadecimal as“\x5c”) and adding a an escape character e.g., “\”), data appliance 302might therefore erroneously rewrite “\x42\x5c\x42\x5c(

)” as “\x42\x5c\x5c\x42\x5c\x5c(

,” which will not be renderable in the end user's browser, as “

” is not a meaningful word in Chinese. As an alternate example, supposedata appliance 302 receives a page that includes the word

, represented as a two 8-bit byte code point in Unicode with UTF-16encoding as “\x22\x8c1x221x8c.” Embodiments of data appliance 302 mighterroneously rewrite “\x22\x8c\x22\x8c” as “\x5c\x22\x8c\x5c\x22\x8c,”inserting the character for “\” into the bytes that form the codepoint“\x22\x8c.” JavaScript syntax requires that a string start with either adouble quote or a single quote, and similarly end with a respectivedouble quote or single quote (forming a pair). in this scenario, inaddition to erroneously transforming the word

(\x22\x8c\x22\x8c) into unknown words “

” (“\x5c\x22\x8c\x5c\x22\x8c”), this also breaks Unicode encoding whichuses 2-byte alignment. The “\x22” could be treated by data appliance 302as a double quote, potentially indicating the end of the string. Anyadditional characters appearing after the \x22 will ignored/excluded andconversion/parsing of the string (e.g., by panportal.js) will fail. Athird example of a potentially problematic special character is thesingle quote (“\x27”) which can similarly appear as a single byte or asa component of a multi-byte character.

The approach taken in the example of FIG. 9B potentially requires anunderstanding (e.g., by data appliance 302) of the encoding type of theinput, and potentially requires the parsing of the original input whichcan increase the load on data appliance 302. And, by adding escapecharacters, the original input (i.e., the web content provided to dataappliance 302) is changed in a way that could potentially bringunexpected results (e.g., when executed by a client device). In variousembodiments, data appliance 302 uses an alternate approach to handlingcode such as is depicted in region 908 of FIG. 9A and mitigates theaforementioned problems. In the alternate approach, data appliance 302does not need to know the encoding type. In particular, in variousembodiments, data appliance 302 is configured to insert a wrapperfunction (973 as depicted in FIG. 9C) around the contents of JavaScriptcode. When the page (including the wrapped code) is passed to the clientbrowser, the browser will execute the function, and transform the codecontained within the function into a string, which can then be used asinput to the pan_eval( ) (or other appropriate function) for analysis(as a string). In the example shown, the values indicated in region 975define an offset for the string.

FIG. 9D illustrates an example of an excerpt of more complicatedJavaScript code to which data appliance 302 has applied a wrapper (e.g.,starting at 982 and ending at 984). As illustrated in FIG. 9D, thisapproach can handle scripts of arbitrary complexity, such as onesinvolving JavaScript code with different languages, different encodings,etc.

FIG. 10 illustrates an example of a process for handling, at aclientless VPN, the rewriting of dynamic content. In variousembodiments, process 1000 is performed by data appliance 302. Theprocess begins at 1002 when web page content comprising dynamic contentis received at a clientless VPN and in response to a request from aclient device for a web page. As one example of portion 1002 of process1000, suppose client device 304 requests a page (e.g., www.cnn.com),such as by interacting with a portal provided by an embodiment of dataappliance 302. When data appliance 302 receives web content from cnn.com(including dynamic content such as JavaScript), that is an example ofportion 1002 of process 1000. The techniques described herein can alsobe used with respect to other kinds of dynamic content, instead of inaddition to JavaScript included within a web page. As one example,XML/XLST content requested by a client device can similarly be handledby data appliance 302 using process 1000. At 1004, a wrapper function isinserted around the dynamic content, modifying the received web pagecontent. One example of such an insertion is depicted in FIG. 9C, wherelines 973 and 975 are inserted by data appliance 302. Another example ofsuch an insertion is depicted in FIG. 9D, where lines 982 and 984 areinserted by data appliance 302. In various embodiments, data appliance302 also takes other actions, such as rewriting any static URIs presentin the web content. In other embodiments, rewriting of static URIs ishandled by client device 304 (i.e., by JavaScript code executing onclient device 304 as served to client device 304 by data appliance 302via a portal). Finally, at 1006, the client device is provided with themodified web content. As previously mentioned, the portal provided toclient device 304 incorporates JavaScript that helps support clientlessVPN functionality, including by evaluating identified JavaScript strings(i.e., as identified/marked by data appliance 302 in accordance withtechniques described herein) and rewriting any URIs contained withinsuch JavaScript.

E. Web Storage

Prior to adoption of HTML5, web application data was typically stored inan end user's browser (e.g., by a domain such as www.example.com) usingcookies. With HTML5, data can also be stored/retrieved/managed using webstorage via a standardized set of function calls as follows. ThesetItem( ) method takes as input a key name and value, and either addsthe key/value pair to the storage, or (if already present in thestorage) updates the value. The getItem( ) method takes as input a keyname and returns that key's value, or null (if the key does not exist).The removeItem( ) method takes as input a key name and will remove thatkey from storage. The key( ) method takes as input an integer (e.g.,“3”) and returns the name of the corresponding key in storage (e.g., thefourth key, as the index starts with 0). The clear( ) method removes allstored keys. In addition to five web storage methods, a property alsoexists (“length”), which returns an integer that represents the numberof data items stored in the storage. Further, a storage event exists,and is fired when a storage area (localStorage or sessionStorage) ismodified.

Web storage can be used in one of two ways: local storage(window.localStorage), which stores data with no expiration date, andsession storage (window.sessionStorage) which persists until a browsertab is closed. Web storage is key-value based, and is compartmentalizedper domain. Thus, a first website (e.g., www.amazon.com) and a secondwebsite (e.g., www.cnn.com) could each include code (e.g., served to aclient browser) setting a username by including a line such as thefollowing in a web page served to an end user's client:

local Storage.setItem(‘username’, ‘jsmith’);

Since the storage area for web storage is reserved per domain, twodifferent domains can use the same key (e.g., “username”) and have thesame, or different values (e.g., “jsmith” or “janesmith”) withoutimpacting the keys/values of other domains.

As explained above, in various embodiments, data appliance 302 rewritesURIs (e.g., in accordance with techniques described herein), such asfrom http://www.cnn.com to http://192.1.2.3/www.cnn.com and fromhttp://www.amazon.com to http://192.1.2.3/www.amazon.com. A conventionalbrowser (e.g., implementing HTML5 standards) will consider the “domain”for both of these rewritten URIs to be 192.1.2.3 (or whatever theapplicable domain of the clientless VPN is). Unfortunately, this canresult in a collision between the local storage used by www.cnn.com andwww.amazon.com (as keys/values will both wind up in a storage area forthe domain 192.1.2.3). Such collisions can present functionalityproblems (e.g., a user may not be able to log in), efficiency problems(e.g., instead of storing certain information locally, it will have tobe provided by the site to the browser each time), and also securityproblems (e.g., where information stored for a first site may be exposedwhen the user interacts with a second site). As will be described inmore detail below, in various embodiments, data appliance 302 isconfigured to wrap (or otherwise extend/replace/augment) the native webstorage functionality provided by an end user's browser, thus allowingfor support of rewritten URIs and also per-domain web storage. Inparticular, in various embodiments, java.Script served by portal 350includes code which supports a web storage layer that works on top ofthe native web storage provided by the browser. Such an approach doesnot require a given site e.g., www.cnn.com or www.amazon.com) to alterthe content that it sends to the client browser (i.e., is transparent tothe website making use of web storage). Such an approach also does notrequire alteration of the browser itself (e.g., alteration of Chrome orFirefox). In particular, and as will be described in more detail below,the JavaScript served by portal 350 generates and makes use of a uniqueidentifier for each domain, and wraps/extends native web storagefunction calls.

FIG. 11 illustrates an example of a process for handling web storageinteractions for a clientless VPN environment. In various embodiments,process 1100 is performed within a browser executing on a client device.As previously mentioned, in various embodiments, a visitor to portal 350can be served JavaScript code (e.g., as panportal.js) which helpssupport clientless VPN functionality, including byaugmenting/superseding various native functionality of a visiting enduser's browser.

Process 1100 begins at 1102 when a native web storage function call isreceived. One example of processing performed at 1102 occurs when aclient (e.g., client device 304) requests (e.g., via portal 350) webcontent that includes a function call requesting an interaction with abrowser's web storage. Suppose a shopping website, such as one availableat www.amazon.com, uses a browser's web storage to save/load an enduser's shopping cart. Every time the user adds an item to the shoppingcart (e.g., by interacting with the page), the item is alsoautomatically added to the user's web storage. An example of such afunction call for saving an item to a web storage is as follows:

-   window.localStorage.setItem(“shopping_cart”, JSON.stringify([{id: 1,    name: “Book 1”}])

Whenever the user next visits the shopping site, the shopping cart canbe accordingly loaded from the browser's web storage, such as throughthe following function call:

-   var    shopping_cart=JSON.parse(window.localStorage.getItem(“shopping_cart”))

An example of portion 1102 of process 1100 occurs when the clientbrowser receives the shopping page that includes such line(s).

At 1104, a modified web storage function call is executed. In particularand as will be described in more detail below), panportal.js includesversions of web storage function calls which extend the functionality ofthe native web storage function calls (and also make use of the nativeweb storage function calls). An example of code that can be included inpanportal.js in various embodiments is depicted, collectively, in FIGS.12A-12C.

As indicated in region 1202, native web storage calls (e.g., forinteraction with native localStorage) are hooked. Attempts by a page(e.g., as served by www.cnn.com or www.amazon.com through portal 350)will be intercepted, such that calls such as the following will interactwith the clientless-VPN aware versions of the functions, instead of thenative ones:

-   window.localStorage.getItem(“aaa”);-   window.localStorage.setItem(“aaa”, “bbb”);-   window.localStorage.key(0);-   window.localStorage.removeItem(“aaa”);-   window.localStorage. clear( );-   window.localStorage. length;

Region 1204 depicts code for an augmented setItem( )call. Region 1206depicts code for an augmented getItem( )call. Region 1208 depicts codefor an augmented removeItem( ) call. Region 1210 depicts code for anaugmented key( )call. Region 1212 depicts code for an augmented clear()call. Region 1214 depicts code for an augmented way of getting the“length” property.

Using the augmented setItem( ) call as an example, region 1216 depictscode for obtaining (by the panportal.js JavaScript code) which websitethe end user is currently visiting in an open browser tab (e.g.,www.amazon.com). The code in region 1216 then determines whether aunique identifier for the domain has already been assigned, and if not,assigns one. In the example shown in region 1216, each unique domain isassigned a unique integer (starting with “0”). That assigned integerwill be combined with all keys used by that domain. As one example,suppose www.amazon.com and www.cnn.com both wish to store values for“username,” The enhanced setItem( )call depicted in region 1204 wouldstore such values using a key of 0_username and 1_username (instead of akey of username for both, which would lead to a collision as explainedabove). Other approaches can also be used to generate unique identifiersfor domains, such as by prepending the name of the domain itself (e.g.,www.amazon.com_username and www.cnn.com_username), as applicable.

In region 1220, the enhanced setItem() call makes a call to the nativestorage, using the aforementioned format (e.g., 0_username) and storinga value. In addition, a determination is made as to whether a key (e.g.,username) already exists for a given domain. If not, at 1218, the key'sidentifier is included in a list of keys used by each given domain(e.g., “www.amazon.com”: {id:0, keys: {username, font_size}}). The arrayof keys is used by the enhanced key( ) call so that only those keysassociated with a given domain (e.g., www.amazon.com, also known by itsidentifier 0) are returned (e.g., 0_username and 0_font_size), ratherthan all keys stored in the web storage (e.g., 0_username, 1_username,0_font_size, etc.). Other web storage function calls are similarlywrapped/enhanced to work with unique domains as shown in the remainderof FIGS. 12A-12C. For example, the enhanced removeItem( )call removesthe key (e.g., 0_username) from both the local storage, and also fromthe list of keys associated with the implicated domain (e.g., removing“username” from “www.amazon.com”: {id:0, keys: {username, font_size}}).Further, while the provided examples generally describe use of functioncalls related to local Storage in a clientless VPN, the same approachcan also be used with respect to other web storage function calls, suchas sessionStorage function calls, and the storage event.

F. Object Property Getter and Setter (Accessor Function Calls) andObject Method Function

FIG. 13 illustrates an example of a snippet of JavaScript code. Snippet1300 is an example of code that could be included in a website (e.g., ashopping website such as is available at www.amazon.com) to detectwhether the code is being executed in a whitelisted iframe domain (e.g.,one operated by Amazon.com, Inc.). If the code is instead determined tobe embedded in an unauthorized domain's web page, the JavaScript codeprovides an error (1302).

As explained above, in various embodiments, data appliance 302 rewritesURIs (e.g., in accordance with techniques described herein), such asfrom http://www.cnn.com to http://192.1.2.3/www.cnn.com and fromhttp://www.amazon.com to http://192.1.2.3/www.amazon.com. Also aspreviously explained, a conventional browser will consider the “domain”(1304) for both of these rewritten URIs to be 192,1.2.3 (or whatever theapplicable domain of the clientless VPN is). Unfortunately, this canresult in a website, such as one incorporating snippet 1300, tomalfunction (e.g., providing an end user with alert 1302 instead ofotherwise rendering the page when it is served via portal 350).

Rather than providing a static list of whitelisted domains (e.g.,“www.amazon.com” and “smile.amazon.com”), snippet 1300 obfuscates thewhitelisted domains, posing a potential challenge for data appliance 302and client device 304 to identify and accurately rewrite any suchwhitelisted domains (e.g., to 192.1.2.3). In particular, data appliance302 may be unable to determine that “a” is “window.top.document” or that“b” is the domain (set using a setter function), prior to its evaluation(via a getter function). And, as a result, a[b] will return the portaldomain (e.g., 192.1,2.3) instead of “www.amazon.com.” In order to returnthe correct content to the browser, at best, additional time/computingresources may be required. And, in many cases, data appliance 302 willbe unable to determine what “a[b]” means, breaking functionality of thepage.

In various embodiments, data appliance 302 is configured to wrap (orotherwise extend/replace/augment) native accessor functions (e.g.,getter and setter functions), thus allowing code such as is shown inFIG. 13 to execute transparently of the clientless VPN environment. Asone example, the setter will be called each time a set occurs, and acallback can be performed to determine which value(s) have been set. Asapplicable, those values can be modified (e.g., by URI rewriting) sothat dynamically referenced resources can be obtained via the clientlessVPN (in accordance with techniques described above). For example, themodified setter can take as input the input originally destined for thenative setter, evaluate it (e.g., using URI rewriting or otherfunctionality provided by panportal.js), and then provide the rewrittenURI to the native setter.

Similarly, the getter is modified such that values reported back towebsite's code (e.g., about the location of a resource, such as animage) are transformed from pointing at data appliance 302 back to theoriginal domain (e.g., www.amazon.com) and thus appear to a website tobe unmanipulated. As one example, the modified getter reports“www.amazon.com/location_of_img.jpg” as a source for a resource insteadof “192.1.2.3/www.amazon.com/location_of_img.jpg” to a script providedby a website, while the resource is actually obtained from“192.1.2.3/www.amazon.com/location_of_img.jpg” when rendering the page.Such a modification to the getter function can be helpful in combatingmalicious JavaScript code which checks to see if it is running in anenvironment in which URIs are rewritten by making use of the getterfunctionality.

he approaches described herein for handling accessor function calls donot require a given site (e.g., www.cnn.com or www.amazon.com) to alterthe content that it sends to the client browser (such as snippet 1300)to function properly (i.e., is transparent to the website) in aclientless VPN environment. Such an approach also does not requirealteration of the browser itself (e.g., alteration of Chrome orFirefox). And, such an approach (and in particular, the functionalityprovided by the modified getter) helps malicious code be tricked intobelieving that it is executing outside of a clientless VPN.

FIG. 14 illustrates an example of a process for handling obfuscated codein a clientless VPN environment. In various embodiments, process 1400 isperformed within a browser executing on a client device. As previouslymentioned, in various embodiments, a visitor to portal 350 can be servedJavaScript code (e.g., as panportal.js) which helps support clientlessVPN functionality, including by augmenting/superseding various nativefunctionality of a visiting end user's browser.

Process 1400 begins at 1402 when a native accessor function call isreceived. One example of processing performed at 1402 occurs when aclient (e.g., client device 304) requests (e.g., via portal 350) webcontent that includes a function call associated with an accessorfunction call (e.g., a setter or getter function call). As one example,portion 1402 of process 1400 occurs when a client device receivessnippet 1300.

At 1404, a modified accessor function call is executed. Examples ofmodified setter and getter functions are depicted in FIGS. 17A and 17B.In various embodiments, JavaScript's Object.defineProperty( ) is used tohook native browser code, and swap out the browser's native functions.Pseudocode excerpts of examples of replacement functions are shown inFIG. 15. In particular, the native setter/getter functions arepreserved, as they will ultimately be called by the modified versions(e.g., as specified in panportal.js).

FIG. 16 depicts an example of a way to hook the “src” attribute of anHTML image object in accordance with the techniques described herein.Similar approaches can be used to hook other attributes, as applicable.Suppose a website (e.g., accessible via portal 350) includes thefollowing line of HTML, regarding its logo:

-   <img.id=“main-logo” src=“/img/main_logo.jpg”/>-   Further suppose that the following line is also included (e.g., in    JavaScript) in the website page:-   var logo=document.getElementById(“main-logo”);

With the aforementioned hooks (e.g., as depicted in FIGS. 15 and 16) inplace, the following line will trigger the modified “set” function to becalled:

-   logo.src=“/img/new_main_logo.jpg”;-   and the following line will trigger the modified “get” function to    be called:-   var new_url=logo.src.

The techniques described herein can also be used in conjunction withmodifying object method function calls.

Although the foregoing embodiments have been described in some detailfor purposes of clarity of understanding, the invention is not limitedto the details provided. There are many alternative ways of implementingthe invention. The disclosed embodiments are illustrative and notrestrictive.

What is claimed is:
 1. A system, comprising: a processor configured to:receive, at a device comprising a clientless VPN, and in response to arequest made by a client device for a web page, web page contentcomprising at least one script element; insert, by the device comprisingthe clientless VPN, a wrapper function around at least a portion of theat least one script element to form modified web content, wherein thewrapper function is usable by a browser executed on the client device toprocess the at least a portion of the at least one script element as asingle string argument; and provide the client device with the modifiedweb content; and a memory coupled to the processor and configured toprovide the processor with instructions.
 2. The system of claim 1,wherein the processor is further configured to rewrite one or more linksassociated with one or more static content items included in the webpage and not rewrite links associated with the dynamic content.
 3. Thesystem of claim 1, wherein the processor is further configured to applyescaping as needed to static content links and not apply escaping todynamic content.
 4. The system recited in claim 1, wherein the devicecomprising the clientless VPN is a security appliance.
 5. The systemrecited in claim 1, wherein the device comprising the clientless VPN isa gateway.
 6. The system recited in claim 1, wherein the devicecomprising the clientless VPN is a firewall.
 7. The system recited inclaim 1, wherein the web page is external to a local enterprise networkof the client device.
 8. The system recited in claim 1, wherein therequest includes a Uniform Resource Identifier (URI).
 9. The systemrecited in claim 1, wherein the processor is further configured toauthenticate a user associated with the request for access to anapplication from the client device.
 10. The system of claim 1 whereinthe client device is configured to perform an evaluation of the scriptelement using the modified web content.
 11. A method, comprising:receiving, at a device comprising a clientless VPN and in response to arequest made by a client device for a web page, web page contentcomprising at least one script element; inserting, by the device, awrapper function around at least a portion of the at least one scriptelement to form modified web content; and providing the client devicewith the modified web content.
 12. A computer program product embodiedin a tangible computer readable storage medium and comprising computerinstructions for: receiving, at a device comprising a clientless VPN,and in response to a request made by a client device for a web page, webpage content comprising at least one script element; inserting, by thedevice, a wrapper function around at least a portion of the at least onescript element to form modified web content; and providing the clientdevice with the modified web content.
 13. A system, comprising: aprocessor configured to: transmit, to a device comprising a clientlessVPN, a request for web page content, wherein the web page contentcomprises at least one script element; receive, in response to therequest, and from the device comprising the clientless VPN, modified webcontent, wherein the modified web content includes a wrapper functioninserted by the device comprising the clientless VPN around at least aportion of the at least one script element; and a memory coupled to theprocessor and configured to provide the processor with instructions.